#include "MachiningCenterCmdDB.h"
#include "gnumfmt.h"
#include <assert.h>

WordFormat MachiningCenterCmdDB::wfCommandFormat_[] = {
	WordFormat("N5"),
	WordFormat("G2"),
	WordFormat("M2"),
	WordFormat("S5"),
	WordFormat("T4"),
	WordFormat("F5.3")
};

MachiningCenterCmdDB::CommandFormatData MachiningCenterCmdDB::cfdParameter_[] = {
	CommandFormatData(Word('G', GCodeNumberFormat(0, 0)),
		"X(5.3|4.4) Y(5.3|4.4) Z(5.3|4.4)"),
	CommandFormatData(Word('G', GCodeNumberFormat(1, 0)),
		"X(5.3|4.4) Y(5.3|4.4) Z(5.3|4.4)")
};

MachiningCenterCmdDB::MachiningCenterCmdDB()
{
	useMetricFormat();
}

WordFormat *MachiningCenterCmdDB::isCommandAddress(Word word)
{
	switch (word.getAddress()) {
	case 'N':
		return &wfCommandFormat_[0];
	case 'G':
		return &wfCommandFormat_[1];
	case 'M':
		return &wfCommandFormat_[2];
	case 'S':
		return &wfCommandFormat_[3];
	case 'T':
		return &wfCommandFormat_[4];
	case 'F':
		return &wfCommandFormat_[5];
	default:
		return 0;
	}
}

CommandFormat MachiningCenterCmdDB::getCommandFormat(Word word)
{
	CommandFormat cf;

	return cf;
}

void MachiningCenterCmdDB::useMetricFormat()
{
	isEnglishFormat_ = false;
}

void MachiningCenterCmdDB::useEnglishFormat()
{
	isEnglishFormat_ = true;
}
